//
//  CYWithdrawSuccessViewController.m
//  cyjf
//
//  Created by tauCross on 2017/5/18.
//  Copyright © 2017年 Auto Financing. All rights reserved.
//

#import "CYWithdrawSuccessViewController.h"



@interface CYWithdrawSuccessViewController ()

@property(nonatomic, strong)UIView *topView;
@property(nonatomic, strong)UILabel *topLabel;
@property(nonatomic, strong)UILabel *topDescLabel;
@property(nonatomic, strong)UIImageView *topImageView;

@property(nonatomic, strong)UIView *progressView;
@property(nonatomic, strong)UIImageView *successImageView;
@property(nonatomic, strong)UILabel *successLabel;
@property(nonatomic, strong)UIView *successLine;
@property(nonatomic, strong)UIImageView *reviewImageView;
@property(nonatomic, strong)UILabel *reviewLabel;
@property(nonatomic, strong)UIView *reviewLine;
@property(nonatomic, strong)UIImageView *resultImageView;
@property(nonatomic, strong)UILabel *resultLabel;

@property(nonatomic, strong)UIButton *okButton;

@end


@implementation CYWithdrawSuccessViewController

- (void)loadUI
{
    self.navigationItem.title = @"申请提现成功";
    
    self.topView = [[UIView alloc] init];
    self.topView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.topView];
    {
        self.topLabel = [[UILabel alloc] init];
        self.topLabel.text = [NSString stringWithFormat:@"预计到账时间：%@", [self.date cy_stringWithFormat:@"yyyy-MM-dd HH:mm"]];
        self.topLabel.font = [UIFont systemFontOfSize:16];
        self.topLabel.textColor = HEXCOLOR(@"444444");
        [self.topLabel sizeToFit];
        [self.topView addSubview:self.topLabel];
        
        self.topDescLabel = [[UILabel alloc] init];
        self.topDescLabel.text = @"（若为法定节假日顺延）";
        self.topDescLabel.font = [UIFont systemFontOfSize:12];
        self.topDescLabel.textColor = HEXCOLOR(@"999999");
        [self.topDescLabel sizeToFit];
        [self.topView addSubview:self.topDescLabel];
        
        self.topImageView = [[UIImageView alloc] initWithImage:CYImage(@"invest_succeeded")];
        [self.topView addSubview:self.topImageView];
    }
    
    self.progressView = [[UIView alloc] init];
    self.progressView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.progressView];
    {
        self.successLine = [UIView cy_lineWithColor:HEXCOLOR(@"D8E8FA")];
        [self.progressView addSubview:self.successLine];
        
        self.reviewLine = [UIView cy_lineWithColor:HEXCOLOR(@"ECECEC")];
        [self.progressView addSubview:self.reviewLine];
        
        self.successImageView = [[UIImageView alloc] initWithImage:CYImage(@"withdraw_progress_apply")];
        [self.progressView addSubview:self.successImageView];
        
        self.reviewImageView = [[UIImageView alloc] initWithImage:CYImage(@"withdraw_progress_review")];
        [self.progressView addSubview:self.reviewImageView];
        
        self.resultImageView = [[UIImageView alloc] initWithImage:CYImage(@"withdraw_progress_result")];
        [self.progressView addSubview:self.resultImageView];
        
        self.successLabel = [[UILabel alloc] init];
        self.successLabel.textColor = APP_DEFAULT_COLOR_BLUE;
        self.successLabel.font = [UIFont systemFontOfSize:16];
        self.successLabel.text = @"提现申请成功";
        [self.successLabel sizeToFit];
        [self.progressView addSubview:self.successLabel];
        
        self.reviewLabel = [[UILabel alloc] init];
        self.reviewLabel.textColor = APP_DEFAULT_COLOR_BLUE;
        self.reviewLabel.font = [UIFont systemFontOfSize:16];
        self.reviewLabel.text = @"等待第三方支付处理中";
        [self.reviewLabel sizeToFit];
        [self.progressView addSubview:self.reviewLabel];
        
        self.resultLabel = [[UILabel alloc] init];
        self.resultLabel.textColor = HEXCOLOR(@"999999");
        self.resultLabel.font = [UIFont systemFontOfSize:16];
        self.resultLabel.text = @"提现到账";
        [self.resultLabel sizeToFit];
        [self.progressView addSubview:self.resultLabel];
    }
    
    self.okButton = [UIButton cy_mainButtonWithTitle:@"知道了"];
    [self.okButton addTarget:self action:@selector(onOKButtonTouchUpInside) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:self.okButton];
}

- (void)layoutUI
{
    self.topView.width = self.contentView.width;
    self.topView.height = 83;
    {
        self.topLabel.centerX = self.topView.width / 2;
        self.topLabel.centerY = 33;
        
        self.topDescLabel.centerX = self.topView.width / 2;
        self.topDescLabel.centerY = 52;
        
        self.topImageView.right = self.topView.width;
        self.topImageView.bottom = self.topView.height;
    }
    
    self.progressView.width = self.contentView.width;
    self.progressView.height = 220;
    self.progressView.left = 0;
    self.progressView.top = self.topView.bottom + 10;
    {
        self.successImageView.left = 20;
        self.successImageView.top = 40;
        
        self.successLine.width = 1;
        self.successLine.height = 59;
        self.successLine.top = self.successImageView.centerY;
        self.successLine.centerX = self.successImageView.centerX;
        
        self.reviewImageView.left = 20;
        self.reviewImageView.centerY = self.successLine.bottom;
        
        self.reviewLine.width = 1;
        self.reviewLine.height = 59;
        self.reviewLine.top = self.reviewImageView.centerY;
        self.reviewLine.centerX = self.reviewImageView.centerX;
        
        self.resultImageView.left = 20;
        self.resultImageView.centerY = self.reviewLine.bottom;
        
        self.successLabel.centerY = self.successImageView.centerY;
        self.successLabel.left = 62;
        
        self.reviewLabel.centerY = self.reviewImageView.centerY;
        self.reviewLabel.left = 62;
        
        self.resultLabel.centerY = self.resultImageView.centerY;
        self.resultLabel.left = 62;
    }
    
    self.okButton.width = self.contentView.width - 40;
    self.okButton.height = 44;
    self.okButton.centerX = self.contentView.width / 2;
    self.okButton.top = self.progressView.bottom + 40;
}

#pragma mark - Control Events
- (void)onOKButtonTouchUpInside
{
    [self back];
}

@end
